#ifndef __THREAD_POOL__
#define __THREAD_POOL__

#include <my_header.h>
#include "tidArr.h"
#include "taskQueue.h"
#include "directoryOperation.h"
#include "timeout.h"
#include "token.h"
#include "send.h"
#include "myLog.h"
#include "register.h"

typedef struct threadPool_s{
    tidArr_t tidArr;         // 子线程的信息
    taskQueue_t taskQueue;   // 任务队列
    pthread_mutex_t mutex;   // 锁
    pthread_cond_t cond;     // 条件变量
    int exitflag;            // 退出标志
}threadPool_t;


int threadPoolInit(threadPool_t* p_threadPool,int workerNum);
int tcpInit(char* ip,char* port);
int makeWorker(threadPool_t* p_threadPool);
int epollAdd(int epollfd,int fd);
int epollDel(int epollfd,int fd);
int tlvResponse(int netfd, uint8_t type,ssize_t length,char *value);
int chooseOptin(TLV_t *tlv, int netfd, pathStack_t *pstack,MYSQL *pthreadMysql,fileMetaData_t * pthreadFileMeta);

#endif
